import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

import Layout from '@/layout'

export const constantRoutes = [{
  path: '/redirect',
  component: Layout,
  hidden: true,
  children: [{
    path: '/redirect/:path(.*)',
    component: () => import('@/views/redirect/index')
  }]
},
{
  path: '/login',
  component: () => import('@/views/login/index'),
  hidden: true
},
{
  path: '/auth-redirect',
  component: () => import('@/views/login/auth-redirect'),
  hidden: true
},
{
  path: '/',
  component: Layout,
  redirect: '/dashboard',
  children: [{
    path: 'dashboard',
    component: () => import('@/views/dashboard/index'),
    name: 'dashboard',
    meta: {
      title: '首页',
      icon: 'el-icon-s-marketing',
      affix: true
    },

  }] ,

},
  {
    path: '/largeScreen',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: '',//'http://server.ttstar.net:9983/#/
        component: () => import('@/views/dashboard/index'),
        name: 'largeScreen',
        meta: { title: '大数据分析中心', icon: 'el-icon-s-marketing', affix: true }
      }
    ]
  }
]

export const asyncRoutes = [{
  path: '/organization',
  component: Layout,
  name: 'organization',
  alwaysShow: true,
  meta: {
    title: '组织管理',
    icon: 'el-icon-s-custom'
  },
  children: [{
    path: 'wasteproduction',
    component: () => import('@/views/organization/wasteproduction/index'),
    name: 'wasteproduction',
    meta: {
      title: '产废单位管理'
    }
  },
  {
    path: 'wasteproduction/create',
    component: () => import('@/views/organization/wasteproduction/create'),
    name: 'wasteproduction-create',
    meta: {
      title: '产废单位新增'
    },
    hidden: true
  },
  {
    path: 'wasteproduction/edit/:id',
    component: () => import('@/views/organization/wasteproduction/create'),
    name: 'wasteproduction-edcit',
    meta: {
      title: '产废单位修改'
    },
    hidden: true
  },
  {
    path: 'wasteproduction/:id/view/:isEdit',
    component: () => import('@/views/organization/wasteproduction/create'),
    name: 'canEdit',
    meta: {
      title: '产废单位详情'
    },
    hidden: true
  },

  {
    path: 'wasteproduction/user/:id',
    component: () => import('@/views/organization/wasteproduction/user'),
    name: 'wasteproduction-user',
    meta: {
      title: '产废单位用户管理'
    },
    hidden: true
  },
  {
    path: 'wasteproduction/user/:id/create',
    component: () => import('@/views/organization/wasteproduction/userCreate'),
    name: 'wasteproduction-user-create',
    meta: {
      title: '产废单位用户新增'
    },
    hidden: true
  },
  {
    path: 'wasteproduction/user/:id/edit/:userid',
    component: () => import('@/views/organization/wasteproduction/userCreate'),
    name: 'wasteproduction-user-edit',
    meta: {
      title: '产废单位用户编辑'
    },
    hidden: true
  },
  {
    path: 'wasteproduction/warehouse/:id',
    component: () => import('@/views/organization/wasteproduction/warehouse/index'),
    name: 'wasteproduction-warehouse',
    meta: {
      title: '产废单位仓库信息'
    },
    hidden: true
  },
  {
    path: 'wasteproduction/warehouse/:id/view/:code',
    component: () => import('@/views/organization/wasteproduction/warehouse/create'),
    name: 'wasteproduction-view',
    meta: {
      title: '产废单位仓库详情'
    },
    hidden: true
  },
  {
    path: 'wasteproduction/warehouse/:id/location/:code',
    component: () => import('@/views/organization/wasteproduction/location/index'),
    name: 'wasteproduction-location',
    meta: {
      title: '库位查询'
    },
    hidden: true
  },
  {
    path: 'transport',
    component: () => import('@/views/organization/transport/index'),
    name: 'transport',
    meta: {
      title: '运输单位管理'
    }
  },
  {
    path: 'transport/create',
    component: () => import('@/views/organization/transport/create'),
    name: 'transport-create',
    meta: {
      title: '运输单位新增'
    },
    hidden: true
  },
  {
    path: 'transport/edit/:id',
    component: () => import('@/views/organization/transport/create'),
    name: 'transport-edit',
    meta: {
      title: '运输单位编辑'
    },
    hidden: true
  },
  {
    path: 'transport/:id/view/:isEdit',
    component: () => import('@/views/organization/transport/create'),
    name: 'canEdit',
    meta: {
      title: '运输单位详情'
    },
    hidden: true
  },
  {
    path: 'transport/car/:id',
    component: () => import('@/views/organization/transport/car/index'),
    name: 'transport-car',
    meta: {
      title: '车辆管理'
    },
    hidden: true
  },
  {
    path: 'transport/car/:id/create',
    component: () => import('@/views/organization/transport/car/create'),
    name: 'transport-car-create',
    meta: {
      title: '车辆新增'
    },
    hidden: true
  },
  {
    path: 'transport/car/:id/edit/:carId',
    component: () => import('@/views/organization/transport/car/create'),
    name: 'transport-car-edit',
    meta: {
      title: '车辆编辑'
    },
    hidden: true
  },
  {
    path: 'transport/car/:id/view/:carId',
    component: () => import('@/views/organization/transport/car/create'),
    name: 'transport-car-view',
    meta: {
      title: '车辆详情'
    },
    hidden: true
  },
  {
    path: 'transport/user/:id',
    component: () => import('@/views/organization/transport/user'),
    name: 'transport-user',
    meta: {
      title: '运输单位用户管理'
    },
    hidden: true
  },
  {
    path: 'transport/user/:id/create',
    component: () => import('@/views/organization/transport/userCreate'),
    name: 'transport-user-create',
    meta: {
      title: '运输单位用户新增'
    },
    hidden: true
  },
  {
    path: 'transport/user/:id/edit/:userid',
    component: () => import('@/views/organization/transport/userCreate'),
    name: 'transport-user-edit',
    meta: {
      title: '运输单位用户编辑'
    },
    hidden: true
  },
  {
    path: 'handle',
    component: () => import('@/views/organization/handle/index'),
    name: 'handle',
    meta: {
      title: '处置单位管理'
    }
  },
  {
    path: 'handle/create',
    component: () => import('@/views/organization/handle/create'),
    name: 'handle-create',
    meta: {
      title: '处置单位新增'
    },
    hidden: true
  },
  {
    path: 'handle/edit/:id',
    component: () => import('@/views/organization/handle/create'),
    name: 'handle-edit',
    meta: {
      title: '处置单位编辑'
    },
    hidden: true
  },
  {
    path: 'handle/:id/view/:isEdit',
    component: () => import('@/views/organization/handle/create'),
    name: 'handle-view',
    meta: {
      title: '处置单位详情'
    },
    hidden: true
  },
  {
    path: 'handle/user/:id',
    component: () => import('@/views/organization/handle/user'),
    name: 'handle-user',
    meta: {
      title: '处置单位用户管理'
    },
    hidden: true
  },
  {
    path: 'handle/user/:id/create',
    component: () => import('@/views/organization/handle/userCreate'),
    name: 'handle-user-create',
    meta: {
      title: '处置单位用户新增'
    },
    hidden: true
  },
  {
    path: 'handle/user/:id/edit/:userid',
    component: () => import('@/views/organization/handle/userCreate'),
    name: 'handle-user-edit',
    meta: {
      title: '处置单位用户编辑'
    },
    hidden: true
  },
  {
    path: 'user',
    component: () => import('@/views/organization/user/index'),
    name: 'user',
    meta: {
      title: '用户管理'
    }
  },
  {
    path: 'user/create',
    component: () => import('@/views/organization/user/create'),
    name: 'user-create',
    meta: {
      title: '用户-新增'
    },
    hidden: true
  },
  {
    path: 'user/edit/:Guid',
    component: () => import('@/views/organization/user/create'),
    name: 'user-edit',
    meta: {
      title: '用户-编辑'
    },
    hidden: true
  },
  {
    path: 'role',
    component: () => import('@/views/organization/role/index'),
    name: 'role',
    meta: {
      title: '角色管理'
    }
  },
  {
    path: 'role/create',
    component: () => import('@/views/organization/role/create'),
    name: 'role-create',
    meta: {
      title: '角色-新增'
    },
    hidden: true
  },
  {

    path: 'role/:id/edit/:name/sort/:sort/disabled/:disabled',
    component: () => import('@/views/organization/role/create'),
    name: 'role-edit',
    meta: {
      title: '角色-编辑'
    },
    hidden: true
  },
  {

    path: 'role/right/:id',
    component: () => import('@/views/organization/role/right'),
    name: 'role-edit',
    meta: {
      title: '权限-编辑'
    },
    hidden: true
  },
  {
    path: 'company',
    component: () => import('@/views/organization/company/index'),
    name: 'company',
    meta: {
      title: '公司信息'
    }
  },
  ]
},
{
  path: '/wastereceipt',
  component: Layout,
  name: 'wastereceipt',
  meta: {
    title: '废物转运管理',
    icon: 'el-icon-s-claim'
  },
  children: [{
    path: 'transformApplyDistribution',
    component: () => import('@/views/wastereceipt/transformApplyDistribution/index'),
    name: 'transformApplyDistribution',
    meta: {
      title: '废物申请管理'
    }
  },
  {
    path: 'transformApplyDistribution/:id/distribution/:isEdit',
    component: () => import('@/views/wastereceipt/transformApplyDistribution/detail'),
    name: 'distribution',
    meta: {
      title: '转运派发'
    },
    hidden: true
  },
  {
    path: 'transformApplyDistribution/:id/detail/:isEdit',
    component: () => import('@/views/wastereceipt/transformApplyDistribution/detail'),
    name: 'distribution',
    meta: {
      title: '查看详情'
    },
    hidden: true
  },

  {
    path: 'detail/:detailId',
    component: () => import('@/views/wastereceipt/transformApplyDistribution/detail'),
    name: 'detail',
    meta: {
      title: '转运申请详情'
    },
    hidden: true
  },
  {
    path: 'orderquery',
    component: () => import('@/views/wastereceipt/orderquery/index'),
    name: 'orderquery',
    meta: {
      title: '转移联单列表'
    }
  },
  {
    path: 'orderquery/index_HwList/:id',
    component: () => import('@/views/wastereceipt/orderquery/index_HwList'),
    name: 'detail',
    meta: {
      title: '转运申请详情'
    },
    hidden: true
  },

  {
    path: 'planfiling',
    component: () => import('@/views/wastereceipt/planfiling/index'),
    name: 'planfiling',
    meta: {
      title: '转运计划备案'
    }
  },
  {
    path: 'planfiling/detail/:id',
    component: () => import('@/views/wastereceipt/planfiling/detail'),
    name: 'detail',
    meta: {
      title: '转运计划详情'
    },
    hidden: true
  },

  // {
  //   path: 'inhouse_receive',
  //   component: () => import('@/views/warehouse/inhouse_receive/index'),
  //   name: 'inhouse_receive',
  //   meta: {
  //     title: '接收废物入库台账'
  //   }
  // },

  // {
  //   path: 'inhouse_Secondary',
  //   component: () => import('@/views/warehouse/inhouse_Secondary/index'),
  //   name: 'inhouse_Secondary',
  //   meta: {
  //     title: '次生废物入库台账'
  //   }
  // },
  // {
  //   path: 'inhouse_Secondary/index_WastTypeList/',
  //   component: () => import('@/views/warehouse/inhouse_Secondary/index_WastTypeList'),
  //   name: 'index_WastTypeList',
  //   meta: {
  //     title: '次生废物入库-废物列表'
  //   }
  // },

  // {
  //   path: 'productionyear',
  //   component: () => import('@/views/wastereceipt/production/year'),
  //   name: 'production-year',
  //   meta: {
  //     title: '废物生产年报管理'
  //   }
  // },
  {
    path: 'managementmonth',
    component: () => import('@/views/wastereceipt/management/month'),
    name: 'management-month',
    meta: {
      title: '废物经营月报管理'
    }
  },
  {
    path: 'managementyear',
    component: () => import('@/views/wastereceipt/management/year'),
    name: 'managementyear',
    meta: {
      title: '废物经营年报管理'
    }
  },
  ]
},
{
  path: '/warehouse',
  component: Layout,
  name: 'warehouse',
  alwaysShow: true,
  meta: {
    title: '仓库管理',
    icon: 'el-icon-s-home'
  },
  children: [{
    path: '',
    component: () => import('@/views/warehouse/warehouse/index'),
    name: '',
    meta: {
      title: '仓库信息'
    }
  },
  {
    path: 'create',
    component: () => import('@/views/warehouse/warehouse/create'),
    name: 'create',
    meta: {
      title: '仓库新增'
    },
    hidden: true
  },
  {
    path: 'edit/:id',
    component: () => import('@/views/warehouse/warehouse/create'),
    name: 'edit',
    meta: {
      title: '仓库编辑'
    },
    hidden: true
  },
  {
    path: 'view/:id',
    component: () => import('@/views/warehouse/warehouse/create'),
    name: 'view',
    meta: {
      title: '仓库详情'
    },
    hidden: true
  },
  {
    path: 'location/:id',
    component: () => import('@/views/warehouse/warehouse/location/index'),
    name: 'location',
    meta: {
      title: '库位管理'
    },
    hidden: true
  },
  {
    path: 'location/:id/create',
    component: () => import('@/views/warehouse/warehouse/location/create'),
    name: 'location-create',
    meta: {
      title: '库位新增'
    },
    hidden: true
  },
  {
    path: 'location/:id/edit/:code',
    component: () => import('@/views/warehouse/warehouse/location/create'),
    name: 'location-edit',
    meta: {
      title: '库位编辑'
    },
    hidden: true
  },
  {
    path: 'stock',
    component: () => import('@/views/warehouse/stock/index'),
    name: 'stock',
    meta: {
      title: '库存查询'
    }
  },
  {
    path: 'stock/index_WastObjList/:id',
    component: () => import('@/views/warehouse/stock/index_wastObjList'),
    name: 'index_WastObjList',
    meta: {
      title: '库存查询——废物列表'
    },
    hidden: true
  },
  {
    path: 'stock/detail/:id',
    component: () => import('@/views/warehouse/stock/detail'),
    name: 'detail',
    meta: {
      title: '危险废物详情'
    },
    hidden: true
  },

  {
    path: 'inhouse_receive',
    component: () => import('@/views/warehouse/inhouse_receive/index'),
    name: 'inhouse_receive',
    meta: {
      title: '接收废物入库台账'
    }
  },
  {
    path: 'inhouse_receive/formList',
    component: () => import('@/views/warehouse/inhouse_receive/formList'),
    name: 'formList',
    meta: {
      title: '接收废物入库-选择转移记录信息'
    },
    hidden: true
  },
  {
    path: 'inhouse_receive/index_WastObjList',
    component: () => import('@/views/warehouse/inhouse_receive/index_WastObjList'),
    name: 'index_WastObjList',
    meta: {
      title: '接收废物入库-选择废物'
    },
    hidden: true
  },
  {
    path: 'inhouse_receive/applyDetail/:id',
    component: () => import('@/views/warehouse/inhouse_receive/applyDetail'),
    name: 'view',
    meta: {
      title: '转运记录详情'
    },
    hidden: true
  },

  {
    path: 'inhouse_Secondary',
    component: () => import('@/views/warehouse/inhouse_Secondary/index'),
    name: 'inhouse_Secondary',
    meta: {
      title: '次生废物入库台账'
    }
  },
  {
    path: 'inhouse_Secondary/index_WastTypeList/',
    component: () => import('@/views/warehouse/inhouse_Secondary/index_WastTypeList'),
    name: 'index_WastTypeList',
    meta: {
      title: '次生废物入库-废物列表'
    },
    hidden: true
  },
  {
    path: 'outhouse_ByTransport',
    component: () => import('@/views/warehouse/outhouse_ByTransport/index'),
    name: 'outhouse_ByTransport',
    meta: {
      title: '委外转移出库台账'
    }
  },
  {
    path: 'outhouse_ByTransport/create',
    component: () => import('@/views/warehouse/outhouse_ByTransport/create'),
    name: 'create',
    meta: {
      title: '新增委外转移出库'
    },
    hidden: true
  },

  {
    path: 'outhouse_ByTransport/index_WastObjList',
    component: () => import('@/views/warehouse/outhouse_ByTransport/index_WastObjList'),
    name: 'index_WastObjList',
    meta: {
      title: '委外转移出库——废物库存列表'
    },
    hidden: true
  },

  ]
},
// {
//   path: '/equipment',
//   component: Layout,
//   name: 'equipment',
//   alwaysShow: true,
//   meta: {
//     title: '设备管理',
//     icon: 'el-icon-s-platform'
//   },
//   children: [{
//     path: '',
//     component: () => import('@/views/equipment/index'),
//     name: '',
//     meta: {
//       title: '设备管理'
//     }
//   },
//   {
//     path: 'create',
//     component: () => import('@/views/equipment/create'),
//     name: 'create',
//     meta: {
//       title: '设备添加'
//     },
//     hidden: true
//   },
//   {
//     path: 'edit/:id',
//     component: () => import('@/views/equipment/create'),
//     name: 'edit',
//     meta: {
//       title: '设备编辑'
//     },
//     hidden: true
//   }
//   ]
// },
{
  path: '/message',
  component: Layout,
  name: 'message',
  alwaysShow: true,
  meta: {
    title: '消息记录',
    icon: 'el-icon-message-solid'
  },
  children: [{
    path: '',
    component: () => import('@/views/message/index'),
    name: '',
    meta: {
      title: '消息记录'
    }
  }]
},
{
  path: '/system',
  component: Layout,
  name: 'system',
  alwaysShow: true,
  meta: {
    title: '系统设置',
    icon: 'el-icon-s-tools'
  },
  children: [{
    path: 'citycode',
    component: () => import('@/views/system/citycode/index'),
    name: 'citycode',
    meta: {
      title: '城市代码管理'
    }
  },
  {
    path: 'citycode/create',
    component: () => import('@/views/system/citycode/create'),
    name: 'citycode-create',
    meta: {
      title: '广西城市代码新增'
    },
    hidden: true
  },
  {
    path: 'citycode/:id/edit/:type',
    component: () => import('@/views/system/citycode/create'),
    name: 'citycode-edit',
    meta: {
      title: '广西城市代码编辑'
    },
    hidden: true
  },
  {
    path: 'safetynotification',
    component: () => import('@/views/system/safetynotification/index'),
    name: 'safetynotification',
    meta: {
      title: '废物安全告知卡管理'
    }
  },
  {
    path: 'safetynotification/create',
    component: () => import('@/views/system/safetynotification/create'),
    name: 'safetynotification-create',
    meta: {
      title: '废物安全告知卡新增'
    },
    hidden: true
  },
  {
    path: 'safetynotification/edit/:id',
    component: () => import('@/views/system/safetynotification/create'),
    name: 'safetynotification-edit',
    meta: {
      title: '废物安全告知卡编辑'
    },
    hidden: true
  },
  {
    path: 'safetynotification/view/:id',
    component: () => import('@/views/system/safetynotification/create'),
    name: 'safetynotification-view',
    meta: {
      title: '废物安全告知卡详情'
    },
    hidden: true
  },
  {
    path: 'dangerouswords',
    component: () => import('@/views/system/dangerouswords/index'),
    name: 'dangerouswords',
    meta: {
      title: '危险用语管理'
    }
  },
  {
    path: 'dangerouswords/create',
    component: () => import('@/views/system/dangerouswords/create'),
    name: 'dangerouswords-create',
    meta: {
      title: '危险用语新增'
    },
    hidden: true
  },
  {
    path: 'dangerouswords/edit/:id',
    component: () => import('@/views/system/dangerouswords/create'),
    name: 'dangerouswords-edit',
    meta: {
      title: '危险用语编辑'
    },
    hidden: true
  },
  {
    path: 'dangerouswords/view/:id',
    component: () => import('@/views/system/dangerouswords/create'),
    name: 'dangerouswords-view',
    meta: {
      title: '危险用语详情'
    },
    hidden: true
  },

  {
    path: 'safetymeasures',
    component: () => import('@/views/system/safetymeasures/index'),
    name: 'safetymeasures',
    meta: {
      title: '禁忌与应急措施管理'
    }
  },
  {
    path: 'safetymeasures/create',
    component: () => import('@/views/system/safetymeasures/create'),
    name: 'safetymeasures-create',
    meta: {
      title: '禁忌与应急措施新增'
    },
    hidden: true
  },
  {
    path: 'safetymeasures/edit/:id',
    component: () => import('@/views/system/safetymeasures/create'),
    name: 'safetymeasures-edit',
    meta: {
      title: '禁忌与应急措施编辑'
    },
    hidden: true
  },
  {
    path: 'safetymeasures/view/:id',
    component: () => import('@/views/system/safetymeasures/create'),
    name: 'safetymeasures-view',
    meta: {
      title: '禁忌与应急措施详情'
    },
    hidden: true
  },

  {
    path: 'remark',
    component: () => import('@/views/system/exceptionremarks/index'),
    name: 'remark',
    meta: {
      title: '出入库异常备注管理'
    }
  },
  {
    path: 'remark/create',
    component: () => import('@/views/system/exceptionremarks/create'),
    name: 'remark-create',
    meta: {
      title: '出入库异常备注新增'
    },
    hidden: true
  },
  {
    path: 'remark/:id/edit/:type',
    component: () => import('@/views/system/exceptionremarks/create'),
    name: 'remark-edit',
    meta: {
      title: '出入库异常备注编辑'
    },
    hidden: true
  },
  {
    path: 'sourceandprocess',
    component: () => import('@/views/system/sourceandprocess/index'),
    name: 'sourceandprocess',
    meta: {
      title: '废物生产来源管理'
    }
  },
  {
    path: 'sourceandprocess/create',
    component: () => import('@/views/system/sourceandprocess/create'),
    name: 'sourceandprocess-create',
    meta: {
      title: '废物生产来源新增'
    },
    hidden: true
  },
  {
    path: 'sourceandprocess/:id/edit/:type',
    component: () => import('@/views/system/sourceandprocess/create'),
    name: 'sourceandprocess-edit',
    meta: {
      title: '废物生产来源编辑'
    },
    hidden: true
  },
  {
    path: 'type',
    component: () => import('@/views/system/type/index'),
    name: 'type',
    meta: {
      title: '废物类别管理'
    }
  },
  {
    path: 'type/create',
    component: () => import('@/views/system/type/create'),
    name: 'type-create',
    meta: {
      title: '废物类别新增'
    },
    hidden: true
  },
  {
    path: 'type/:id/edit/:type',
    component: () => import('@/views/system/type/create'),
    name: 'type-edit',
    meta: {
      title: '废物类别编辑'
    },
    hidden: true
  },
  {
    path: 'type/:id/view/:type',
    component: () => import('@/views/system/type/create'),
    name: 'type-view',
    meta: {
      title: '废物类别详情'
    },
    hidden: true
  },
  {
    path: 'type/code/:id',
    component: () => import('@/views/system/type/code/index'),
    name: 'type-code',
    meta: {
      title: '废物代码管理'
    },
    hidden: true
  },
  {
    path: 'type/code/:id/create',
    component: () => import('@/views/system/type/code/create'),
    name: 'type-code-create',
    meta: {
      title: '废物代码新增'
    },
    hidden: true
  },
  {
    path: 'type/:type/code/:id/edit/:code',
    component: () => import('@/views/system/type/code/create'),
    name: 'type-code-edit',
    meta: {
      title: '废物代码编辑'
    },
    hidden: true
  },
  {
    path: 'baseinformation',
    component: () => import('@/views/system/baseinformation/index'),
    name: 'baseinformation',
    meta: {
      title: '废物基本信息管理'
    }
  },
  {
    path: 'baseinformation/create',
    component: () => import('@/views/system/baseinformation/create'),
    name: 'baseinformation-create',
    meta: {
      title: '废物基本信息新增'
    },
    hidden: true
  },
  {
    path: 'baseinformation/edit/:id',
    component: () => import('@/views/system/baseinformation/create'),
    name: 'baseinformation-edit',
    meta: {
      title: '废物基本信息编辑'
    },
    hidden: true
  },
  {
    path: 'baseinformation/view/:id',
    component: () => import('@/views/system/baseinformation/create'),
    name: 'baseinformation-view',
    meta: {
      title: '废物基本信息详情'
    },
    hidden: true
  }
  ]
}
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRoutes
})

const router = createRouter()

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher
}

export default router
